#include <msp430x20x3.h>

int flag = 1;

void main(void)
{
	int i;
	int j;

 	DCOCTL  = CALDCO_1MHZ;
 	BCSCTL1 = CALBC1_1MHZ;
 	
 	WDTCTL = WDT_ADLY_1000;
 	
 	IE1 |= WDTIE;
 	
 	P1DIR = 0xFF;
 	P1OUT = 0;
 	P2DIR = 0xFF;
 	P2OUT = 0;
 	
 	P1OUT = 0x80;
 	
 	while (1) {
 		for (i = 0; i < 6; i++) 
 			for (j = 0; j < 0x7FFF; j++);
 		P1OUT = 0;
 		_BIS_SR(LPM3_bits + GIE);
 	}
}

#pragma vector=WDT_VECTOR                     //(9)
__interrupt void watchdog_timer(void)
{
	if (flag == 1) {
		P1OUT = 0x40;
		flag = 0;
	} else {
		P1OUT = 0x80;
		flag = 1;
	}
	_BIC_SR_IRQ(LPM3_bits);
}
